//预付款充值表单验证
$("#PayFormAdd").find("input,select").jqBootstrapValidation({
  preventSubmit: true,
  submitSuccess: function($form, event) {
    $.ajax({
      url: "/Handler/PayHandler.ashx",
      type: "post",
      dataType: "json",
      data: {
        fun: "f_0001",
        data: JSON.stringify($("#PayFormAdd").serializeObject())
      },
      beforeSend: function() {
        //数据加载冻屏
        $form.find("button[type=submit]").button('loading');
      },
      success: function(msg) {
        //数据加载完毕解除冻屏
        $form.find("button[type=submit]").button('reset');
        if (msg.r_code == "1") {
          toastr.success(msg.r_info, '系统提示：');
          //清空form表单
          $form.get(0).reset();
          $form.parent().modal('hide');
          $form.parent().remove();
          //刷新页面
          $("#submitBTN").click();
        } else if (msg.r_code == "0") {
          toastr.error(msg.r_info, '错误提示：');
        }
      }
    });
    event.preventDefault();
  },
  filter: function() {
    return $(this).is(":visible");
  }
});

$("#PayFormAdd #Pay_PayRetailID").select2({
  width:"180px",
  placeholder: "请选择",
  allowClear: true
});
